package com.zhumo.sz.mapper;


import com.zhumo.sz.entity.area.BaseArea;
import com.zhumo.sz.entity.road.*;
import com.zhumo.sz.provider.BatchInsertProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mapstruct.Mapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface RoadMapper {

    @Update("TRUNCATE table sz_traffic.city_road")
    void clearCityRoad();


    @InsertProvider(type = BatchInsertProvider.class,method = "batchInsert")
    int addCityRoad(@Param("list") List<CityRoad> cityRoadList);


    @InsertProvider(type = BatchInsertProvider.class,method = "batchInsert")
    int addCityHighRoad(@Param("list") List<CityHighRoad> cityHighRoadList);

    @Update("TRUNCATE table sz_traffic.city_high_road;")
    void clearHighCityRoad();

    /**
     * 获取所有高速公路信息
     */
    @Select("select * from sz_traffic.city_high_road;")
    List<CityHighRoad> getAllHighRoads();

    @Select("select * from sz_traffic.city_high_road where id = #{roadId};")
    CityHighRoad getHighRoadBy(@Param("roadId") String roadId);

    @InsertProvider(type = BatchInsertProvider.class,method = "batchInsert")
    int addHighRoadStation(@Param("list") List<HighSpeedTollStation> cityHighRoadList);

    @Select("select * from sz_traffic.high_speed_toll_station;")
    List<HighSpeedTollStation> getAllHighRoadStations();

    @Update("TRUNCATE table sz_traffic.road_velocity_detail;")
    void clearVelocity();

    @Select("select * from sz_traffic.city_road")
    List<CityRoad> getAllRoad();

    @InsertProvider(type = BatchInsertProvider.class,method = "batchInsert")
    int addRoadVelocity(@Param("list") List<RoadVelocityDetail> roadVelocityList);


    @Update("TRUNCATE table sz_traffic.city_expressway_etc_detail;")
    void clearEtc();

    /**
     * 插入etc 高速上下行信息
     */
    @InsertProvider(type = BatchInsertProvider.class,method = "batchInsert")
    int addEtcData(@Param("list") List<CityExpresswayEtcDetail> etcList);
}
